<template>
    <section>
        <el-row>
            <el-col :span="16" :offset="3">
                <!--视频显示-->
                <!--<video  width="150%" height="100%" :src='video_url'  controls="controls" loop>
                    <source  type="video/mp4">
                    your browser doesn't suppot video.
                </video>-->
                <video width="90%" type="application/x-shockwave-flash" height="90%" :src='video_url' controls="controls" autoplay="autoplay">
                    <embed type="application/x-shockwave-flash" :src='video_url' name="MediaPlayer"
                           showstatusbar="1" showdisplay="1" showcontrols="1" loop="0" videoborder3d="0"
                           pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="800" height="600">
                    </embed>

                </video>
            </el-col>
        </el-row>
        <el-row>
            <el-row>
                <el-col :span="6" :offset="3">
                    <el-input :placeholder="infodata.courseName" v-model="input3" :disabled="true">
                        <template slot="prepend">课程名称</template>
                    </el-input>
                </el-col>
                <el-col :span="6" :offset="2">
                    <el-input :placeholder="infodata.sectionName" v-model="input5" :disabled="true">
                        <template slot="prepend">章节名称</template>
                    </el-input>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6" :offset="3">
                    <el-input :placeholder="infodata.partName" v-model="input3" :disabled="true">
                        <template slot="prepend">小节名称</template>
                    </el-input>
                </el-col>
                <el-col :span="6" :offset="2">
                    <el-input :placeholder="infodata.partFrequence" v-model="input3" :disabled="true">
                        <template slot="prepend">访问次数</template>
                    </el-input>
                </el-col>
            </el-row>
        </el-row>
    </section>
</template>
<style>

</style>
<script>
    import {getCourseInfos, getVideo, getVideoPlayUrl,partFrequence} from '../../api/api';

    export default {
        data() {
            return {
                infodata: '',
                listLoading: false,
                video_url: '',
                data: [],
                defaultProps: {
                    children: 'children',
                    label: 'label'
                },

                listLoading: false,
                videoLoading: false
            }
        },
        methods: {
            //返回前一页
            forback() {
                console.log("详细信息的课程编号：" + this.$route.query.courseId)
                this.$router.push({name: '学习课程', path: '/stu_course', query: {courseId: this.$route.params.courseId}});
            },
            //根据小节编号获得课程所有信息
            getCourseInfo() {

                let para = {

                    partId: this.$route.params.id
                };

                this.listLoading = true;

                getCourseInfos(para).then((res) => {
                    this.infodata = res.resData;
                    this.listLoading = false;
                });
            },
            //获取视频
            getVideos() {
                let para = {
                    partId:this.$route.params.id
                }
                console.log("视频路径是:" + this.video_url);
                this.videoLoading = true;
                getVideo(para).then((res) => {
                    this.video_url = getVideoPlayUrl() + res.resData.videoPath;
                    this.videoLoading = false;
                });
                partFrequence(para).then((res) => {
                });
            },
        },

        mounted() {
            this.getCourseInfo();
            this.getVideos();
        }
    }

</script>